home *** CD-ROM | disk | FTP | other *** search
- ;This is a procedure callable from QBasic to get the old screen from a
- ;buffer passed as the address of a 2000 integer array.
-
- Name Getscrn ;Name used at link time
- Public Getscrn ;Only label that is public
-
- Getscrn: org 0 ;Since we will link later
- jmp short Getpara ;Get parameters
-
- Vidmem equ 0B800h ;Video page 1 segment
- Scrnbuf: dw ? ;Screen buffer location from Basic
- Msg1: db 'Not in a color mode now.$' ;Error message
-
- Getpara: push bp
- mov bp,sp
- push es
- push ds
- push cs ;es=cs
- pop es
- cld
- mov bx,[bp+6] ;Get address of screen buffer location in ds
- mov ax,[bx] ;Get location of screen buffer in ds
- mov cs:[Scrnbuf],ax
-
- ;Get current video mode and page
- mov ah,15 ;Get current video mode
- int 10h
- cmp al,2 ;Mode 2?
- je Color ;Yes
- cmp al,3 ;Mode 3?
- je Color ;Yes
- mov dx,Msg1 ;No, print message
- mov ah,9
- int 21h
- Exit: ;Return to Basic
- pop ds
- pop es
- pop bp
- retf 2
-
- Color: ;Find video memory.
- cld ;Set to inc si & di
- mov bl,0 ;bx=page offset
- add bx,Vidmem ;Add page 0 address
-
- ;Save current screen.
- mov es,bx ;Set dest segment for screen mem
- mov si,cs:[Scrnbuf] ;Point source to buffer in in ds
- mov di,0 ;Start of screen
- mov cx,80*25 ;Words to move
- rep movsw ;Move them
- jmp Exit
-